local skel = fk.CreateSkill {
  name = "emo__longque",
  tags = {Skill.Compulsory},
}

skel:addEffect(fk.AfterCardsMove, {
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(skel.name) then return false end
    for _, move in ipairs(data) do
      if move.toArea == Card.DiscardPile then
        for _, info in ipairs(move.moveInfo) do
          local card = Fk:getCardById(info.cardId)
          if card.type == Card.TypeTrick and (card.multiple_targets or card.sub_type == Card.SubtypeDelayedTrick) then
            return true
          end
        end
      end
    end
  end,
  trigger_times = function (self, event, target, player, data)
    local n = 0
    for _, move in ipairs(data) do
      if move.toArea == Card.DiscardPile then
        for _, info in ipairs(move.moveInfo) do
          local card = Fk:getCardById(info.cardId)
          if card.type == Card.TypeTrick and (card.multiple_targets or card.sub_type == Card.SubtypeDelayedTrick) then
            n = n + 1
          end
        end
      end
    end
    return n
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, skel.name)
  end,
})

skel:addEffect("prohibit", {
  is_prohibited = function (self, from, to, card)
    return to and to:hasSkill(skel.name) and card and card.type == Card.TypeTrick
    and (card.multiple_targets or card.sub_type == Card.SubtypeDelayedTrick)
  end,
})

Fk:loadTranslationTable{
  ["emo__longque"] = "笼雀",
  [":emo__longque"] = "锁定技，延时锦囊牌和多目标锦囊不能指定你为目标；每当一张延时锦囊牌或多目标锦囊进入弃牌堆后，你摸一张牌。",
}


return skel
